package Test01;

import Test02.DialogDemo;

import javax.swing.*;
import java.awt.*;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: YKH
 * Date: 2022-05-14
 * Time: 12:03
 * author:framepertice
 */
public class framepertice {
    public static void main(String[] args) {
        new MyJframe();
    }
}

class MyJframe extends JFrame {
    protected  MyJframe() {
        super("Swing练习");
    }
    public void init() {
        //设置背景颜色要先获得一个容器
        Container container = this.getContentPane();
        container.setBackground(Color.YELLOW);
        setBounds(100,200,300,400);
        JLabel label = new JLabel("欢迎来到图书管理系统");
        //设置标签居中
        label.setHorizontalAlignment(SwingConstants.CENTER);
        add(label);
        //设置可见性
        setVisible(true);
        //设置关闭监听
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }
}
